<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Father(uname, age) {
            //this指向父构造函数的实例对象
            this.uname = uname;
            this.age = age;
        }
        function Son(uname, age) {
            //this指向子构造函数的实例对象
            //调用父构造函数并使用call函数  
            //把父构造函数里的this改成了子构造函数里的this（代码写在子构造函数里）
            Father.call(this, uname, age);
        }

        var son = new Son('刘德华', 18);
        console.log(son);

    </script>
</body>
</html>